<div style="padding-top: 15px; padding-bottom: 15px;">
	<div class="container">
		<a routerLink="/learn" class="btn btn-outline-dark" style="margin-top: 5px;">Back</a>
		<h2>Video</h2>
		<p>In this guide we will explore how to import and use video files in nunuStudio. Video files can be used as textures for objects.</p>
		<p>To load a new video file select Texture and then Video texture, this will create two thing first a video resource that contains the video file select, and a Video texture that uses the video resource to display the file. Alternatively you can drag and drop a video file to the explorer or directly to an object.</p>

		<h3>External files</h3>
		<p>It is possible to load external files from their URL. When using external files if they are a diferent domain don't forget to make sure that the server has the appropiate CORS configuration. The code bellow demonstrates how to create a VideoTexture from an external URL and to use it as a texture for the default material.</p>
		<p>You can choose between a Video resource and a VideoStream resource, the main difference is that Video preloads the whole video files into memory and VideoStream loads the video as it goes.</p>
		<pre><code class="hljs javascript">{{'{'}}
var texture = new VideoTexture(new VideoStream("sample.mp4"));
var material = program.getMaterialByName("default");
material.emissiveMap = texture;
material.emissive.setHex(0xFFFFFF);
{{'}'}}</code></pre>

		<app-viewer fname="assets/learn/basics/video/video.nsp"></app-viewer>
	</div>
</div>
